<template>
    <div class="flex h-full overflow-hidden my-2 gap-2">

        <!-- 侧边栏 -->
        <Sidebar :sidebarOpen="sidebarOpen" @toggle-sidebar="toggleSidebar"></Sidebar>

        <!-- 二级路由 -->
        <div :class="sidebarOpen ? 'ml-0' : '-ml-42'" class="flex flex-col flex-1 transition-all duration-300 mr-2">
            <router-view></router-view>
        </div>
    </div>
</template>

<script setup>
import { Icon } from "@iconify/vue";
import { ref, onMounted, onBeforeUnmount, reactive, nextTick } from 'vue'
import { useRouter, useRoute } from 'vue-router'
// 导入获取历史对话列表的API
import { deleteChat, findHistoryChatPageList, renameChat } from '@/api/chat'
import { message } from "ant-design-vue";
import SvgIcon from "@/components/common/SvgIcon.vue";
import Sidebar from "@/components/ai/Sidebar.vue";

// 左边栏状态，true 表示默认展开
const sidebarOpen = ref(true)

// 切换侧边栏显示状态/隐藏
const toggleSidebar = () => {
    sidebarOpen.value = !sidebarOpen.value
}

</script>